import { http } from '@/utils/http'

/** 查询部门列表 */
export const listDept = (params?: object) => {
  return http.request<HttpTreeResponse<Array<any>>>('get', '/system/dept/list', {
    params,
  })
}

/** 查询部门列表（排除节点） */
export const listDeptExcludeChild = (deptId: number) => {
  return http.request<HttpPaginationResponse<Array<any>>>(
    'get',
    '/system/dept/list/exclude/' + deptId
  )
}

/** 查询部门详细 */
export const getDept = (deptId: number) => {
  return http.request<HttpResponse<Object>>('get', '/system/dept/' + deptId)
}

/** 新增部门 */
export const addDept = (data?: object) => {
  return http.request<HttpResponse<Object>>('post', '/system/dept', {
    data,
  })
}

/** 修改部门 */
export const updateDept = (data?: object) => {
  return http.request<HttpResponse<Object>>('put', '/system/dept', {
    data,
  })
}

/** 删除部门 */
export const delDept = (deptId?: string) => {
  return http.request<HttpResponse<Object>>('delete', '/system/dept/' + deptId)
}
